#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
bool zero(vector<int>& a) {
  rep(i, 0, n - 1) if (a[i]) return false;
  return true;
}
bool equal(vector<int>& a, vector<int>& b) {
  rep(i, 0, n - 1) if (a[i] != b[i]) return false;
  return true;
}
bool exist(vector<int>& a, vector<vector<int>>& data) {
  for (vector<int>& b : data) {
    if (equal(a, b)) return true;
  }
  return false;
}
void solve() {
  set<vector<int>> st;
  cin >> n;
  vector<int> a(n);
  for (int& x : a) cin >> x;
  bool f = false;
  rep(i, 1, 1000) {
    int a0 = a[0];
    rep(i, 0, n - 1) a[i] = abs((i == n - 1 ? a0 : a[i + 1]) - a[i]);
    if (zero(a)) {
      f = true;
      break;
    }
  }
  cout << (f ? "ZERO" : "LOOP") << endl;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}